<?php

class Application_Model_UserStatsTbl extends  Zend_Db_Table_Abstract
{
	protected $_name = 'user_stats';
	
	function checkIfUserExists($user_id)
    {
        $select = $this->_db->select()
                            ->from($this->_name,array('user_fk'))
                            ->where('user_fk=?',$user_id);
        $result = $this->getAdapter()->fetchOne($select);
        if($result){
            return true;
        }
        return false;
    }
    
    //id, user_fk, power, attack_points, wealth, income, gold_earn, gold_lost, 
    //hero_level, turns_played, current_population, total_population
    function getUserStats($user_id)
    {
    	$select = $this->_db->select()
                            ->from($this->_name)
                            ->where('user_fk=?',$user_id);
                            
                            
        $result = $this->getAdapter()->fetchRow($select);
    	return $result;
    }
}

